correct bug introduced to an1 reader wrt url strings.
authortsteven4@gmail.com <tsteven4@gmail.com@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 7 Jan 2014 23:32:31 +0000 (23:32 +0000)
committertsteven4@gmail.com <tsteven4@gmail.com@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 7 Jan 2014 23:32:31 +0000 (23:32 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4718 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/an1.cc

index 2ef6b42f461eed9cf6c403ec4dc008fdca81e417..80bc8e1288ef9cbec380c7a9066d1ff544e03260 100644 (file)
@@ -713,9 +713,13 @@ static void Read_AN1_Waypoints(gbfile* f)
       wpt_tmp->AddUrlLink(rec->url);
     } else {
       int u = wpt_tmp->description.indexOf("{URL=");
-      QString us = wpt_tmp->description.mid(u);
-      if (!us.isEmpty()) {
-        wpt_tmp->AddUrlLink(us);
+      if (u != -1) {
+        QString us = wpt_tmp->description.mid(u);
+        us.remove(0,5); // throw away anything up to and including "{URL="
+        us.chop(1); // throw away final character, assumed to be "}"
+        if (!us.isEmpty()) {
+          wpt_tmp->AddUrlLink(us);
+        }
       }
     }